package com.erpx.api.stock;

import com.erpx.api.WdtClient;
import com.erpx.api.param.StockChangeAckParam;
import com.erpx.utils.JsonUtils;
import com.erpx.api.CommonConstants;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 库存同步回传  确认接口  库存同步回传返回同步结果接口
 */
public class StockSyncAckService {
    public static void stockChangeAck() throws Exception {
        WdtClient client = new WdtClient(CommonConstants.sid, CommonConstants.appkey, CommonConstants.appSecret, CommonConstants.baseUrl);

        Map<String, String> params = new HashMap<String, String>();
        List<StockChangeAckParam> list = new ArrayList<>();
        StockChangeAckParam stockChangeAckParam = new StockChangeAckParam();
        stockChangeAckParam.setRecId(1L);
        stockChangeAckParam.setSyncStock(10);
        stockChangeAckParam.setIsSynSuccess(1);
        stockChangeAckParam.setStockChangeCount(111);
        list.add(stockChangeAckParam);

        params.put("stock_sync_list", JsonUtils.serialize(list));
        try {
            String response = client.execute("api_goods_stock_change_ack.php", params);
            System.out.println(response);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
